package com.fish.anne.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name="order" )
public class Order extends BaseObject implements Serializable {
	
	
	
    private Long orderId;
    private Integer discount;
    private Integer finalAmount;
    private Integer totalAmount;
    private String ip;
    private Long autoId;
    private Long memberId;
    private byte orderConfirm;
    private byte payStatus;
    private byte paymentTypeId;
    private String startDate;
    private String startPlaceId;
    private String endDate;
    private String endPlaceId;
    private boolean selfFlag;
    private String shipAddr;
    private String shipEmail;
    private String shipMobile;
    private byte status;
    private String taxCompany;
    private boolean taxOn;
    private Long createTime;
    private Long lastChangeTime;

    @Id   @GeneratedValue(strategy = GenerationType.AUTO)    
    public Long getOrderId() {
        return this.orderId;
    }
    
    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }
    
    @Column(name="discount", nullable=false)
    public Integer getDiscount() {
        return this.discount;
    }
    
    public void setDiscount(Integer discount) {
        this.discount = discount;
    }
    
    @Column(name="final_amount", nullable=false)
    public Integer getFinalAmount() {
        return this.finalAmount;
    }
    
    public void setFinalAmount(Integer finalAmount) {
        this.finalAmount = finalAmount;
    }
    
    @Column(name="total_amount", nullable=false)
    public Integer getTotalAmount() {
        return this.totalAmount;
    }
    
    public void setTotalAmount(Integer totalAmount) {
        this.totalAmount = totalAmount;
    }
    
    @Column(name="ip", nullable=false, length=16)
    public String getIp() {
        return this.ip;
    }
    
    public void setIp(String ip) {
        this.ip = ip;
    }
    
    @Column(name="auto_id", nullable=false)
    public Long getAutoId() {
        return this.autoId;
    }
    
    public void setAutoId(Long autoId) {
        this.autoId = autoId;
    }
    
    @Column(name="member_id", nullable=false)
    public Long getMemberId() {
        return this.memberId;
    }
    
    public void setMemberId(Long memberId) {
        this.memberId = memberId;
    }
    
    @Column(name="order_confirm", nullable=false)
    public byte getOrderConfirm() {
        return this.orderConfirm;
    }
    
    /**
     * unuse
     * @param orderConfirm
     */
    public void setOrderConfirm(byte orderConfirm) {
        this.orderConfirm = orderConfirm;
    }
    
    @Column(name="pay_status", nullable=false)
    public byte getPayStatus() {
        return this.payStatus;
    }
    
    public void setPayStatus(byte payStatus) {
        this.payStatus = payStatus;
    }
    
    @Column(name="payment_type_id", nullable=false)
    public byte getPaymentTypeId() {
        return this.paymentTypeId;
    }
    
    public void setPaymentTypeId(byte paymentTypeId) {
        this.paymentTypeId = paymentTypeId;
    }
    
    @Column(name="start_date", nullable=false, length=20)
    public String getStartDate() {
        return this.startDate;
    }
    
    public void setStartDate(String startDate) {
        this.startDate = startDate;
    }
    
    @Column(name="start_place_id", nullable=false, length=100)
    public String getStartPlaceId() {
        return this.startPlaceId;
    }
    
    public void setStartPlaceId(String startPlaceId) {
        this.startPlaceId = startPlaceId;
    }
    
    @Column(name="end_date", nullable=false, length=100)
    public String getEndDate() {
        return this.endDate;
    }
    
    public void setEndDate(String endDate) {
        this.endDate = endDate;
    }
    
    @Column(name="end_place_id", nullable=false, length=100)
    public String getEndPlaceId() {
        return this.endPlaceId;
    }
    
    public void setEndPlaceId(String endPlaceId) {
        this.endPlaceId = endPlaceId;
    }
    
    @Column(name="self_flag", nullable=false)
    public boolean isSelfFlag() {
        return this.selfFlag;
    }
    
    public void setSelfFlag(boolean selfFlag) {
        this.selfFlag = selfFlag;
    }
    
    @Column(name="ship_addr", nullable=false, length=100)
    public String getShipAddr() {
        return this.shipAddr;
    }
    
    public void setShipAddr(String shipAddr) {
        this.shipAddr = shipAddr;
    }
    
    @Column(name="ship_email", nullable=false, length=150)
    public String getShipEmail() {
        return this.shipEmail;
    }
    
    public void setShipEmail(String shipEmail) {
        this.shipEmail = shipEmail;
    }
    
    @Column(name="ship_mobile", nullable=false, length=50)
    public String getShipMobile() {
        return this.shipMobile;
    }
    
    public void setShipMobile(String shipMobile) {
        this.shipMobile = shipMobile;
    }
    
    @Column(name="status", nullable=false)
    public byte getStatus() {
        return this.status;
    }
    
    public void setStatus(byte status) {
        this.status = status;
    }
    
    @Column(name="tax_company", nullable=false)
    public String getTaxCompany() {
        return this.taxCompany;
    }
    
    public void setTaxCompany(String taxCompany) {
        this.taxCompany = taxCompany;
    }
    
    @Column(name="tax_on", nullable=false)
    public boolean isTaxOn() {
        return this.taxOn;
    }
    
    public void setTaxOn(boolean taxOn) {
        this.taxOn = taxOn;
    }
    
    public String getCreateTimeString() {
		return super.convert(createTime);
	}
    @Column(name="create_time", nullable=false)
    public Long getCreateTime() {
        return this.createTime;
    }
    
    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }
    
    @Column(name="last_change_time", nullable=false)
    public Long getLastChangeTime() {
        return this.lastChangeTime;
    }
    
    public void setLastChangeTime(Long lastChangeTime) {
        this.lastChangeTime = lastChangeTime;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Order pojo = (Order) o;

        if (discount != null ? !discount.equals(pojo.discount) : pojo.discount != null) return false;
        if (finalAmount != null ? !finalAmount.equals(pojo.finalAmount) : pojo.finalAmount != null) return false;
        if (totalAmount != null ? !totalAmount.equals(pojo.totalAmount) : pojo.totalAmount != null) return false;
        if (ip != null ? !ip.equals(pojo.ip) : pojo.ip != null) return false;
        if (autoId != null ? !autoId.equals(pojo.autoId) : pojo.autoId != null) return false;
        if (memberId != null ? !memberId.equals(pojo.memberId) : pojo.memberId != null) return false;
         if (startDate != null ? !startDate.equals(pojo.startDate) : pojo.startDate != null) return false;
        if (startPlaceId != null ? !startPlaceId.equals(pojo.startPlaceId) : pojo.startPlaceId != null) return false;
        if (endDate != null ? !endDate.equals(pojo.endDate) : pojo.endDate != null) return false;
        if (endPlaceId != null ? !endPlaceId.equals(pojo.endPlaceId) : pojo.endPlaceId != null) return false;
        if (selfFlag != pojo.selfFlag) return false;
        if (shipAddr != null ? !shipAddr.equals(pojo.shipAddr) : pojo.shipAddr != null) return false;
        if (shipEmail != null ? !shipEmail.equals(pojo.shipEmail) : pojo.shipEmail != null) return false;
        if (shipMobile != null ? !shipMobile.equals(pojo.shipMobile) : pojo.shipMobile != null) return false;
         if (taxCompany != null ? !taxCompany.equals(pojo.taxCompany) : pojo.taxCompany != null) return false;
        if (taxOn != pojo.taxOn) return false;
        if (createTime != null ? !createTime.equals(pojo.createTime) : pojo.createTime != null) return false;
        if (lastChangeTime != null ? !lastChangeTime.equals(pojo.lastChangeTime) : pojo.lastChangeTime != null) return false;

        return true;
    }

    public int hashCode() {
        int result = 0;
        result = (discount != null ? discount.hashCode() : 0);
        result = 31 * result + (finalAmount != null ? finalAmount.hashCode() : 0);
        result = 31 * result + (totalAmount != null ? totalAmount.hashCode() : 0);
        result = 31 * result + (ip != null ? ip.hashCode() : 0);
        result = 31 * result + (autoId != null ? autoId.hashCode() : 0);
        result = 31 * result + (memberId != null ? memberId.hashCode() : 0);
         result = 31 * result + (startDate != null ? startDate.hashCode() : 0);
        result = 31 * result + (startPlaceId != null ? startPlaceId.hashCode() : 0);
        result = 31 * result + (endDate != null ? endDate.hashCode() : 0);
        result = 31 * result + (endPlaceId != null ? endPlaceId.hashCode() : 0);
        result = 31 * result + (selfFlag ? 1 : 0);
        result = 31 * result + (shipAddr != null ? shipAddr.hashCode() : 0);
        result = 31 * result + (shipEmail != null ? shipEmail.hashCode() : 0);
        result = 31 * result + (shipMobile != null ? shipMobile.hashCode() : 0);
         result = 31 * result + (taxCompany != null ? taxCompany.hashCode() : 0);
        result = 31 * result + (taxOn ? 1 : 0);
        result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
        result = 31 * result + (lastChangeTime != null ? lastChangeTime.hashCode() : 0);

        return result;
    }

    public String toString() {
        StringBuffer sb = new StringBuffer(getClass().getSimpleName());

        sb.append(" [");
        sb.append("orderId").append("='").append(getOrderId()).append("', ");
        sb.append("discount").append("='").append(getDiscount()).append("', ");
        sb.append("finalAmount").append("='").append(getFinalAmount()).append("', ");
        sb.append("totalAmount").append("='").append(getTotalAmount()).append("', ");
        sb.append("ip").append("='").append(getIp()).append("', ");
        sb.append("autoId").append("='").append(getAutoId()).append("', ");
        sb.append("memberId").append("='").append(getMemberId()).append("', ");
        sb.append("orderConfirm").append("='").append(getOrderConfirm()).append("', ");
        sb.append("payStatus").append("='").append(getPayStatus()).append("', ");
        sb.append("paymentTypeId").append("='").append(getPaymentTypeId()).append("', ");
        sb.append("startDate").append("='").append(getStartDate()).append("', ");
        sb.append("startPlaceId").append("='").append(getStartPlaceId()).append("', ");
        sb.append("endDate").append("='").append(getEndDate()).append("', ");
        sb.append("endPlaceId").append("='").append(getEndPlaceId()).append("', ");
        sb.append("selfFlag").append("='").append(isSelfFlag()).append("', ");
        sb.append("shipAddr").append("='").append(getShipAddr()).append("', ");
        sb.append("shipEmail").append("='").append(getShipEmail()).append("', ");
        sb.append("shipMobile").append("='").append(getShipMobile()).append("', ");
        sb.append("status").append("='").append(getStatus()).append("', ");
        sb.append("taxCompany").append("='").append(getTaxCompany()).append("', ");
        sb.append("taxOn").append("='").append(isTaxOn()).append("', ");
        sb.append("createTime").append("='").append(getCreateTime()).append("', ");
        sb.append("lastChangeTime").append("='").append(getLastChangeTime()).append("'");
        sb.append("]");
      
        return sb.toString();
    }

}
